#pragma once
#include <string>
#include <iostream>

class IStorage
{
public:
    virtual void Save(const std::string& data) = 0;
};

class FileStorage : public IStorage
{
public:
    void Save(const std::string& data) override
    {
        std::cout << "保存到文件: " << data << std::endl;
    }
};

class BusinessLogic
{
public:
    BusinessLogic(IStorage& storage) : _storage(storage) {}

    void Process()
    {
        // 只依赖于抽象 IStorage
        _storage.Save("业务数据");
    }
private:
    IStorage& _storage;
};